package DB;

/** this class asks queries to get and insert cities's details from and into the db  */
public class CitiesQuery {
	
	/**function which get all cities from db */
	public static String getAllCities()
	{
		return "SELECT * FROM cities";
	}
	
	/**function which insert city id and city name into db */
	public static String insertCity(String CityID,String CityName)
	{   
		String str="INSERT INTO cities (CityID, CityName) VALUES (\"" + CityID + "\",\"" + CityName + "\")"; 
		return str;	
	}
	
	/**function which delete city from db where city id is like writen*/
	public static String deleteCity(String CityID,String CityName)
	{
		String str="DELETE   FROM cities " +" WHERE CityID= \""+CityID+"\"";			
		return str;	
	}
	
	/**function which check if city is in db */
	public static String checkExistCity(String CityID)
	{
		return "SELECT * FROM cities WHERE CityID = " + "\"" + CityID + "\"";
	} 
	
	/**functions which check if a field is empty */
	public  boolean isEmpty(String field) {
		if (field.isEmpty())
			return true;
		return false;
	}
	
	public  boolean isEmpty(int field) {
		if (field!=0)
			return true;
		return false;
	}
}
